<?php 
$updateScript =<<<EOD
	function(){
	var dialogButton = {
		Update:function(){
			var dialog = $(this);
			$.cargo_item_form = {
				afterSubmit:function(data){
					var container = $('#items');
					$(container).subcontent({url:'$itemUrl',show:{method:'html'}});
					$(dialog).dialog('close');
				}
			};
			$(this).find('form').find('[type=submit]').click();
		}
	};
	$.simplelogdialog({url:$(this).attr('href')},{width:600},dialogButton);
	return false;
	}
EOD;

$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'cargo-item-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		'marking',
		'item',
		'country',
		'detail.qty',
		'cost',
		array(
			'name'=>'Total cost',
			'value'=>'$data->cost*$data->detail->qty',
		),
		array(
			'class'=>'CButtonColumn',
			'template'=>'{update} {delete}',
			'buttons'=>array(
				'update'=>array(
					'click'=>$updateScript,
				)
			)
		),
	),
)); ?>
<br />